package unit2_1010.test5;

public class Dog {

	private String name;
	private int health;
	private String sex;
	private int love;

	public Dog() {
		super();
	}

	public Dog(String name, int health, String sex, int love) {
		super();
		this.name = name;
		this.health = health;
		this.sex = sex;
		this.love = love;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public int getHealth() {
		return health;
	}

	public void setHealth(int health) {
		if (health < 1 || health > 100) {
			System.out.println("健康值应在1-100之间，默认60");
			health = 60;
		}
		this.health = health;

	}

	public String getSex() {
		return sex;
	}

	public void setSex(String sex) {
		this.sex = sex;
	}

	public int getLove() {
		return love;
	}

	public void setLove(int love) {
		if (love < 1 || love > 10) {
			System.out.println("有效亲密度在1-10之间，默认为5");
			love = 5;
		}
		this.love = love;
	}

	public void show() {
		System.out.println("宠物狗自白：\n" + "昵称：" + name + ",性别：" + sex + ",健康值：" + health + ",与主人的亲密度：" + love);
	}

}
